<template>
  <a-drawer
    width="45%"
    :title="formTitle"
    :label-col="4"
    :wrapper-col="14"
    :visible="open"
    :body-style="{ height: 'calc(100vh - 100px)', overflow: 'auto' }"
    @close="cancel"
  >
    <a-form-model ref="form" :model="form" :rules="rules" layout="vertical">
      <a-spin :spinning="spinning" :delay="delayTime" tip="Loading...">
        <a-row :gutter="32" style="width: 40%; margin-left: 30%">
          <a-col :span="24">
            <a-form-model-item label="产品服务机构" prop="orgType">
              <a-select
                placeholder="请选择产品所属机构"
                v-model="form.orgType"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
              >
                <a-select-option
                  v-for="(d, index) in orgTypeOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="产品名称" prop="productName">
              <a-input
                v-model="form.productName"
                placeholder="请输入产品名称"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="产品类型" prop="productType">
              <a-select
                placeholder="请选择产品类型"
                v-model="form.productType"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
              >
                <a-select-option
                  v-for="(d, index) in productTypeOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="贷款额度(最低)" prop="startEdu">
              <a-input-number
                v-model="form.startEdu"
                :min="0"
                style="width: 100%"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="贷款额度(最高)" prop="endEdu">
              <a-input-number
                v-model="form.endEdu"
                :min="0"
                style="width: 100%"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="14">
            <a-form-model-item label="利率" prop="lv">
              <a-input-number v-model="form.lv" :min="0" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="10">
            <a-form-model-item label="利率类型" prop="lvType">
              <a-select
                placeholder="利率类型"
                v-model="form.lvType"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
              >
                <a-select-option
                  v-for="(d, index) in lvTypeOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>

          <a-col :span="14">
            <a-form-model-item label="分期月数（xx-xx）" prop="fenqiTime">
              <a-input-number
                v-model="form.fenqiTime"
                :min="0"
                style="width: 100%"
              />
            </a-form-model-item>
          </a-col>
          <!-- <a-col :span="10">
            <a-form-model-item label="分期方式" prop="fenqiType">
              <a-select
                placeholder="分期方式"
                v-model="form.fenqiType"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
              >
                <a-select-option
                  v-for="(d, index) in fenqiTypeOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col> -->
          <!-- <a-col :span="14">
            <a-form-model-item label="抵押月数" prop="diyaTime">
              <a-input v-model="form.diyaTime" placeholder="请输入抵押月数" />
            </a-form-model-item>
          </a-col> -->
          <a-col :span="10">
            <a-form-model-item label="还款方式" prop="backType">
              <a-select
                placeholder="还款方式"
                v-model="form.backType"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
              >
                <a-select-option
                  v-for="(d, index) in backTypeOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>

          <a-col :span="24">
            <a-form-model-item label="产品条件" prop="productTiaojian">
              <a-textarea
                v-model="form.productTiaojian"
                placeholder="请输入产品条件"
                :rows="4"
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="12">
            <a-form-model-item label="负责人/电话" prop="duijieName1">
              <a-input v-model="form.duijieName1" placeholder="姓名/电话" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="费用" prop="feiyong">
              <a-input-number
                v-model="form.feiyong"
                :min="0"
                style="width: 100%"
                placeholder="产品费用"
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="24">
            <a-form-model-item label="备注" prop="remark">
              <a-textarea
                v-model="form.remark"
                placeholder="请输入备注"
                :rows="4"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-spin>
      <div class="bottom-control">
        <a-space>
          <a-button @click="cancel"> 取消 </a-button>
          <a-button type="primary" @click="submitForm"> 保存 </a-button>
        </a-space>
      </div>
    </a-form-model>
  </a-drawer>
</template>
<script>
import BizProductInfoEditForm from "./BizProductInfoForm";
export default {
  ...BizProductInfoEditForm,
};
</script>
